package com.bing.bean.Tpp.tuling;

import com.bing.bean.weixin.Article;
import com.bing.bean.weixin.RequestMessage;
import com.bing.bean.weixin.ResponseMessage;
import com.bing.utils.MsgHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/6/6.
 */
public class Flights extends AbstractMsg {
    private List<Flight> list;

    @Override
    public ResponseMessage toMsg(RequestMessage requestMessage) {
        List<Article> articles = new ArrayList<>();
        int i = 1;
        for (Flight n : list) {
            if (i > 10) {
                break;
            }
            i++;
            Article article = new Article();
            article.setContent(n.getStarttime() + "----" + n.getEndtime());
            article.setDescription(n.getRoute() + "---" + n.getFlight());
            article.setPicUrl(n.getIcon());
            article.setUrl(n.getDetailurl());
            article.setTitle(n.getFlight() + " " + n.getRoute() + " " + n.getStarttime() + "----" + n.getEndtime());
            articles.add(article);
        }
        return MsgHelper.toNews(requestMessage, articles);
    }

    public List<Flight> getList() {
        return list;
    }

    public void setList(List<Flight> list) {
        this.list = list;
    }

    public class Flight {
        private String flight;
        private String route;
        private String starttime;
        private String endtime;
        private String state;
        private String detailurl;
        private String icon;

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }

        public String getFlight() {
            return flight;
        }

        public void setFlight(String flight) {
            this.flight = flight;
        }

        public String getRoute() {
            return route;
        }

        public void setRoute(String route) {
            this.route = route;
        }

        public String getStarttime() {
            return starttime;
        }

        public void setStarttime(String starttime) {
            this.starttime = starttime;
        }

        public String getEndtime() {
            return endtime;
        }

        public void setEndtime(String endtime) {
            this.endtime = endtime;
        }

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getDetailurl() {
            return detailurl;
        }

        public void setDetailurl(String detailurl) {
            this.detailurl = detailurl;
        }
    }
}
